package com.sanjin.controller;


import com.sanjin.common.result.Result;
import com.sanjin.domain.dto.LoginDto;
import com.sanjin.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/auth")
public class AuthController {
    @Autowired
    private LoginService loginService;

    @Autowired
    private AuthenticationManager authenticationManager;

    /**
     * 系统登录请求
     */
    @PostMapping("/login")
    public Result login(@RequestBody LoginDto loginDto){
        return loginService.login(loginDto);
    }

    /**
     * 退出请求
     * @return
     */
    @PostMapping("/logout")
    public Result logout(){
        return Result.success();
    }
}
